package admin

import (
	"exercise/application/yiran/app/libs"
	request2 "exercise/application/yiran/app/request"
	"exercise/application/yiran/app/service"
	"github.com/gin-gonic/gin"
)

type loginController struct {
}

func (l loginController) Login(ctx *gin.Context) {
	request := new(request2.LoginRequest)
	err := libs.BindRequest(ctx, request)
	if err != nil {
		libs.Toast(ctx, err.Error())
		return
	}
	ret := service.NewLoginService().Login(ctx, request)
	libs.Success(ctx, ret)

}

func NewLoginController() *loginController {
	return &loginController{}
}
